home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus Special 13
/
AMIGAplus Sonderheft 13 (1998)(ICP)(DE)[!].iso
/
rexx
/
rect_to_polar.scrx
< prev
next >
Wrap
Text File
|
1997-11-01
|
723b
|
39 lines
/* SciCalc Scientific Calculator
by Brian Savage copyright 1997
Arexx script to convert cartesian coordinates to polar
coordinates.
This script requires RexxMathLib.library
*/
if ~show("l", "rexxmathlib.library") then
if ~addlib("rexxmathlib.library", 0, -30,0) then
do
address command
say "Can't find RexxMathLib"
end
options results
getreg 1 /* y -> from register #1 */
parse var result y
getval /* x -> displayed value */
parse var result x
putval sqrt(x**2+y**2) /* radius r -> displayed value */
putreg 1 atan(y/x) /* angle theta (radians) -> returned
in register 1 */